<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter" %>
<%@include file="/WEB-INF/pages/commons/commons.jsp" %>

<stripes:layout-render name="${_themePath}/basic-layout-without-navbar.jsp" _title="Users Listing">

    <stripes:layout-component name="_head">
        <c:out value="${_head}" escapeXml="false"/>
        <meta content="_listUsers_" name="_uniquePageId_"/>
    </stripes:layout-component>

    <stripes:layout-component name="_topNav">
        <H1>User Listing</H1>
        <UL class="gc-topnav-tabs">
            <LI>&nbsp;</LI>
        </UL>
    </stripes:layout-component>


    <stripes:layout-component name="_content">
        <h2>Description [<a id="_showDescription" href="#">Show</a>/<a id="_hideDescription" href="#">Hide</a>]</h2>
        <div id="_description">
        <p>
            Following are the listing of all users that are currently available in FooBarWiki.
            <ul>
            <li>View - Click on 'View' link
            to view their profile </li>
            <li>Edit - to make alteration to it.</li>
            <li>Delete - will remove the user permanently from
            the system.</li>
            </ul>
        </p>
        <p>
            Do take note that once a user is being removed from FooBarWiki all his activities will no longer be trackable,
            eg. the creation or modification of pages done by this deleted user will be identified as Anonymous.
            Probably the better way is to actually disabled his account, such that he could no longer log in as that user
            but still preserving all his changes / alterations.
        </p>
        <p/>
        <p/>
        <p/>
        </div>


        <h2>Available users</h2>
        <stripes:messages/>
        <stripes:errors/>
        <br/>
        <foobarwiki:hasAnyPermissions name="user:view:*|user:edit:*|user:remove:*">
        <stripes:url var="url" beanclass="foo.bar.wiki.web.action.user.ListUsersActionBean" event="view" />
        <displaytag:table id="element" name="actionBean.users"
                                  sort="external"
                                  excludedParams="*"
                                  defaultsort="1"
                                  defaultorder="ascending"
                                  requestURI="${url}" 
                                  requestURIcontext="true" style="width:100%" >
                    <displaytag_el:column property="username" sortable="false" sortName="username" title="Username" />
                    <displaytag_el:column property="email" sortable="false" sortName="emailAddress" title="Email" />
                    <displaytag_el:column title="Actions">
                        <stripes:link class="_view" beanclass="foo.bar.wiki.web.action.user.ViewUserActionBean" event="view">
                            <stripes:param name="user" value="${element.id}"/>
                            View
                        </stripes:link>|
                        <stripes:link class="_edit" beanclass="foo.bar.wiki.web.action.user.EditUserActionBean" event="view">
                            <stripes:param name="user" value="${element.id}"/>
                            Edit
                        </stripes:link>|
                        <stripes:link class="_remove" beanclass="foo.bar.wiki.web.action.user.RemoveUserActionBean" event="remove">
                            <stripes:param name="user" value="${element.id}"/>
                            Remove
                        </stripes:link>
                    </displaytag_el:column>
                </displaytag:table>
        </foobarwiki:hasAnyPermissions>
    </stripes:layout-component>
</stripes:layout-render>


